package cn.com.alibaba.dao;

import org.hibernate.Transaction;
import org.hibernate.classic.Session;
import org.junit.Test;

import cn.com.alibaba.domain.User;
import cn.com.alibaba.utils.HibernateUtils;

public class Demo {

	@Test
	public void fun1(){
		
		Session session = (Session) HibernateUtils.getCurrentSession();
		Transaction bt = session.beginTransaction();
		
		User u = new User();
		u.setUserName("mary");
		u.setLoginName("tom");
		u.setLoginPwd("123");
		session.save(u);
		
		bt.commit();
		//session.close();
		HibernateUtils.close();
	}
}
